<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/view_job.php
 ^ 
 * Description: template view for a job
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
  global $mainframe;
  $document =& JFactory::getDocument();
  $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);

?>

<?php if( isset($this->job)){ ?>
	<?php
	$vj = $this->vj; 
	if ($vj == '1'){
		$vm=1;//my jobs 
	}else if ($vj == '2'){
		$vm=2; $aj=1;//job cat
	}else if ($vj == '3'){
		$vm=3; $aj=2;//job search
	}else if ($vj == '4'){
		$vm=4; //my applied jobs
	}else if ($vj == '5'){
		$vm=5; $aj=3;//newest jobs
	}else if ($vj == '6'){
		$vm=5; $aj=1;//company jobs jobs
	}
	?>
	<div class="box-list">
		<div class="head-title">
		<?php if ($this->listjobconfig['lj_title'] == '1') {   ?>
			<?php 
				$job = $this->job->title;
				$days = $this->config['newdays'];
				$isnew = date("Y-m-d H:i:s", strtotime("-$days days"));
				if ($this->job->created > $isnew)
					$job .= "<font color='#FE7613'> ".JText::_('JS_NEW')." </font>";
			?>
			<h2><?php echo $job; ?></h2>
		<?php } ?>
		</div>
		
		<div class="post-detail-box">
			<div class="post-detail-text">
				<p>
					<span class="title">Employer:</span>
					<span class="description"><?php echo $this->job->companyname; ?></span>
				</p>
				
				<p>
					<span class="title">Posted:</span>
					<span class="description"><?php echo date('d F Y', strtotime($this->job->created)); ?></span>
				</p>
				<p>
					<span class="title">Contact:</span>
					<span class="description"><?php echo $this->company->contactname ?></span>
				</p>
				<?php if ($this->listjobconfig['lj_country'] == '1') { ?>
				<p>
					<span class="title">Locatoin:</span>
					<span class="description"><?php echo $this->job->countryname; ?></span>
				</p>
				<?php } ?>
				<?php if ($this->listjobconfig['lj_company'] == '1') { ?>
				<p>
					<?php 
						$link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=' . $this->job->jobcategory . '&Itemid=' . $this->Itemid;
					?>
					<span class="title">Industry:</span>
					<span class="description industry"><a href="<?php echo $link?>"><?php echo $this->job->cat_title; ?></a></span>
				</p>
				<?php } ?>
				<?php if($this->job->subcategory) { ?>
				<p>
					<span class="title">Function:</span>
					<span class="description"><?php echo $this->job->subcategory; ?></span>
				</p>
				<?php } ?>
				<?php if(!empty($this->job->duration)){ ?>
				<p>
					<span class="title">Contract:</span>
					<span class="description"><?php echo $this->job->duration; ?></span>
				</p>
				<?php } ?>
				<?php if ($this->listjobconfig['lj_jobtype'] == '1') { ?>
				<p>
					<span class="title">Hours:</span>
					<span class="description"><?php echo $this->job->jobtypetitle; ?></span>
				</p>
				<?php } ?>
				<?php if ( $this->job->hidesalaryrange != 1 ) { ?>
				<p>
					<span class="title">Salary:</span>
					<span class="description">
					<?php
						if ($this->job->salaryfrom) echo $this->job->symbol. $this->job->salaryfrom;
						if ($this->job->salaryto) echo ' - ' . $this->job->symbol . $this->job->salaryto;
						if ($this->job->salarytype) echo ' ' . $this->job->salarytype;
					?>
					</span>
				</p>
				<?php } ?>
			</div>
			
			<div class="post-detail-right">
				<div class="post-image">
				<?php if ($this->company->logoisfile !=-1) { ?>
					<img width="142" src="<?php echo $this->config['data_directory'];?>/data/employer/comp_<?php echo $this->company->id;?>/logo/<?php echo $this->company->logofilename;?>" />
				<?php } ?>
				</div>
			</div>
            <?php if (($vj == '2') || ($vj == '3') || ($vj == '5') || ($vj == '6')){ 
				if ($this->job->isApplicable) {?>
					<?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=job_apply&aj='.$aj.'&jobcat='.$this->job->jobcategory.'&bi='.$this->job->id.'&Itemid='.$this->Itemid; ?>
					<div id="apply-now">
						<a href="<?php echo $link?>" class="gradient-button-yellow"><!--<img src="./images/wrecruit/apply-cv.gif" width="142" height="27" alt="Apply width CV" title="Apply with CV" />-->Apply now!</a>
					</div>
				<?php 
				}
			}?>
		</div>
	</div>
	
	<div class="box-list further-info-box">
		<div class="head-title">
			<h2>Further Information</h2>
		</div>
		<div class="further-infomation">
        	<?php if ($this->job->requireIncludeCompanyDescrition && !empty($this->company->description)) echo '<h4>About Organization</h4>'. $this->company->description ; ?>
			<?php if (!empty($this->job->description)) echo '<h4>Job Description</h4>'. $this->job->description; ?>
			<?php if (!empty($this->job->experiencetext)) echo '<h4>Job Requirement</h4>'.  $this->job->experiencetext; ?>
			<?php if (!empty($this->job->qualifications)) echo '<h4>Qualitification</h4>'. $this->job->qualifications; ?>
			<?php if (!empty($this->job->morebenefit)) echo '<h4>Job Benefit</h4>'. $this->job->morebenefit; ?>
		</div>
		<div class="button-apply-cv">
		<?php if (($vj == '2') || ($vj == '3') || ($vj == '5') || ($vj == '6')){ 
			if ($this->job->isApplicable) {?>
			<?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=job_apply&aj='.$aj.'&jobcat='.$this->job->jobcategory.'&bi='.$this->job->id.'&Itemid='.$this->Itemid; ?>
			<a href="<?php echo $link?>" class="gradient-button-yellow"><!--<img src="./images/wrecruit/apply-cv.gif" width="142" height="27" alt="Apply width CV" title="Apply with CV" />-->Apply now!</a>
		<?php } }?>
		</div>
	</div>
<?php }
	else {
?>
	<div class="box-list">
		<div class="head-title"><h2>Job not found</h2></div>
<?php 
	echo JText::_('Sorry but we cannot find this job. We apology for this inconvenience. You continue searching for other relevant jobs.');
?>
	</div>
   <?php } ?>